import { isvalidPagePath } from '@/utils/validate'
import { Vue } from 'vue-property-decorator'

export interface EnumPathInputType extends Vue {
  clearOption: () => void;
}


const validatePagePath = (rule: string, value: string, callback: (err?: Error) => void) => {
  if (!value) {
    callback(new Error('请输入'));
  } else if (isvalidPagePath(value)) {
    callback();
  } else {
    callback(new Error('路径格式不正确'));
  }
};

export const rule = [
  { required: true, message: '请输入', trigger: 'blur' },
  { validator: validatePagePath, trigger: 'blur' }
]
